<template>
  <view>
    <!-- 收获地址盒子 -->
    <view v-if="JSON.stringify(address)==='{}'" class="address-choose-box" style="border-bottom: 1px dashed red;">
     <button @click="chooseAddress" type="primary" size="mini" class="btnChooseAddress">请选择收获地址</button>
    </view>
    <!-- 收获地址 -->
    <view class="address-info-box" v-else>
      <view class="row1">
        <view class="row1-left">
          <view class="username">收货人:{{address.defaultName}}</view>
        </view>
        <view class="row1-right">
          <view class="phoneNumber">电话:{{address.defaultPhoneNumber}}</view>
          <uni-icons type="arrowright" size="16"></uni-icons>
        </view>
      </view>
      <view class="row2">
        <view class="row2-left">收货地址:</view>
        <view class="row2-right">{{address.defaultProvince}}{{address.defaultCity}}{{address.defaultCounty}}{{address.defaultDetailInfo}}</view>
      </view>
    </view>
  </view>
</template>

<script>
  import {mapState,mapMutations} from 'vuex'
 export default{
   data(){
     return{
       address:{},
       defaultAddress:{
         defaultName:'王五',
         defaultPhoneNumber:17386542345,
         defaultProvince:'四川省',
         defaultCity:'成都市',
         defaultCounty:'锦江区',
         defaultDetailInfo:'柳江街道257号'
       }
     };
   },
   methods:{
    chooseAddress(){
     this.address=this.defaultAddress
     }
   }
 }
</script>

<style lang="scss">
.address-choose-box{
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.address-info-box{
  font-size: 12px;
  height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 5px;
  .row1{
    display: flex;
    justify-content: space-between;
    .row1-right{
      display: flex;
      justify-content: space-between;
    }
  }
  .row2{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    .row2-left{
      white-space: nowrap;
    }
  }
}
</style>